package com.zq.zqmanager.job;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @program: zqmanager
 * @Date: 2020/3/8 19:48
 * @Author: zhengqiang
 * @Description:
 */
@DisallowConcurrentExecution
public class MyJob extends QuartzJobBean {
    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        JobDataMap map = jobExecutionContext.getJobDetail().getJobDataMap();
        String value = map.getString("key");
        String name = map.getString("name");
        value = value==null?"":value;
        name = name==null?"":name;
        System.out.println("hello:"+name+",now="+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
    }
}
